package org.eclipse.epsilon.emc.rdbms.core.imodel;

import java.util.HashMap;


public class DBReflexiveModelElement 
{

	protected String type = "";   //tablename
	protected HashMap<String, Object> props = new HashMap<String, Object>();  //primaryKey Map
	protected DBReflexiveModel owner; //Model Name
	
	/**
	 * This sets the owner of the element. This is the table name that the row will belong to.
	 * @type This is the tablename that the element will belong to
	*/
	public void setOwner(DBReflexiveModel type)
	{
		
		this.owner = type;
	}

	/**
	 * This gets the owner of the element. This is the table name that the row will belong to.
	 * @return This is the tablename that the element will belong to
	*/
	public DBReflexiveModel getOwner()
	{
		
	return owner;	
	}
	
	/**
	 * This creates a newModelElement.
	 * @param type This is the tablename that the element will belong to
	*/
	public DBReflexiveModelElement (String type) 
	{
		super();
		this.type = type;
	}

	/**
	 * This sets the type of the element.
	 * @param type This is the tablename that the element will belong to
	*/	
	public void setType(String type) 
	{
		this.type = type;
	}

	/**
	 * This gets the type of the element.
	 * @return type This is the tablename that the element will belong to
	*/	
	public String getType() 
	{
		return type;
	}

	/**
	 * This gets the properties of the Element. The properties are the primary key columns and values associated with the specific element.
	 * @return props This returns the hashmap of all the column and values associated with the primary key for the element.
	*/	
	public HashMap<String, Object> getProps() 
	{
		return props;
	}
	
	/**
	 * This adds the name and value to the props HashMap, this will be the primary key values associated with the element. 
	 * @param name This is the column name from the table/type
	 * @param value This is the value associated with the specific column
	 *  @return props This returns the hashmap of all the column and values associated with the primary key for the element.
	*/		
	public DBReflexiveModelElement put(String name, Object value) 
	{
		props.put(name, value);
		return this;
	}

	/**
	 * This converts the value to String and will return the name of the type of Object
	 * @return This returns the string of Object of type.
	*/		
	@Override
	public String toString() 
	{
		return "Object of type " + type;
	}
}


